$(function(){
	//点击请选择按钮出现下拉框
	var downflag = [1,1,1];
	$(".AC-xx").click(function(e){
		e.stopPropagation();
		var i = $(this).index(".AC-xx");
		if(downflag[i]==1){
			$(".AC-select").eq(i).stop().slideDown(500).parents(".AC-xx").siblings(".AC-xx").children(".AC-select").stop().slideUp(500);
			$(".AC-xx img").eq(i).css({"transform":"rotate(-180deg)","transition":"0.3s"}).parents(".AC-xx").siblings(".AC-xx").children(".AC-xx img").css({"transform":"rotate(0deg)","transition":"0.3s"});
			$.each(downflag,function(n){
				downflag[n]=1;
			})
			downflag[i] = 0;
		}else{
			$(".AC-select").eq(i).stop().slideUp(500);
			$(".AC-xx img").eq(i).css({"transform":"rotate(0deg)","transition":"0.3s"});
			downflag[i] = 1;
		}
	})
	$(document).click(function(){
		$(".AC-select").css("display","none");
			$(".AC-xx img").css({"transform":"rotate(0deg)","transition":"0.3s"});
	})
	$(".AC-select li").click(function(){
		$(this).parents(".AC-xx").children(".AC-qxz").val($(this).html())
	})

	// 开发语言选择
	var dlarr = [];
	$(".AC-dl ul li").click(function(){
		var i = $(this).index(".AC-dl ul li");
		if(dlarr.indexOf(i)==-1){
			dlarr.push(i);
			$(".AC-dl ul li").eq(i).children("span").css({"background":"url(images/AC_success.png) no-repeat","background-size":"100% 100%"});
		}else{
			dlarr.splice(dlarr.indexOf(i),1);
			$(".AC-dl ul li").eq(i).children("span").css({"background":"none"});
		}
	})
    
    // 价格与周期验证
    $(".AC-price").blur(function(){
    	var reg = /^[0-9]*$/;
    	if(!reg.test($(this).val())){
    		$(this).parent().children("label").css("display","block")
    	}else{
    		$(this).parent().children("label").css("display","none")
    	}
    })
    $(".AC-time").blur(function(){
    	var reg = /^[0-9]*$/;
    	if(!reg.test($(this).val())){
    		$(this).parent().children("label").css("display","block")
    	}else{
    		$(this).parent().children("label").css("display","none")
    	}
    }) 

	// 附件上传
	var filestr = "";
	$("#file_upload").change(function(){
		filestr += "<li><img src='images/AC_file.jpg'><span>"+$('#file_upload').val()+"</span><a href='javascript:;'>删除</a></li>";
		$(".AC-files").html(filestr);
		//点击删除，删除附加文件
		$(".AC-files li a").click(function(){
			$(this).parent(".AC-files li").remove()
		})
	})
	//提交
	$(".AC-submit").click(function(){
		window.location.href="MyPrice.html";
	})
})